package com.gusto.samples.cluster.mock;


import java.util.HashMap;
import java.util.Map;

import com.gusto.engine.clusterant.access.DistanceDAO;

public class DistanceDAOImpl implements DistanceDAO {
	
	Map<String, Double> distances;
	 
	public DistanceDAOImpl() {
		super();
		distances = new HashMap<String, Double>();
		
		distances.put("1-2", 0.9);
		distances.put("2-3", 0.8);
		
		distances.put("1-9", -0.8);
		distances.put("2-9", 0.3);
		distances.put("3-9", 0.3);
		
		distances.put("6-7", 0.9);
		distances.put("8-7", 0.8);
		
		distances.put("2-7", 0.6);
		
		distances.put("12-9", 0.9);
		distances.put("12-5", 0.9);
		
		distances.put("11-4", 0.9);
		distances.put("11-8", 0.6);
		distances.put("11-10", 0.2);
		
		//distances.put("5-4", 0.42);
		//distances.put("9-5", 0.5);
	}

	public Double getDistance(Object o, Object neighbor) {
		/*
		for (UserDistance dist : distanceDAO.getUsersDistances()) {
			distances.put(dist.getUser1().getId() + "-" + dist.getUser2().getId(), dist.getDistance().getDistance());
		}
		*/
		
		
		if (distances.containsKey(o + "-" + neighbor)) {
			return distances.get(o + "-" + neighbor);
		}
		if (distances.containsKey(neighbor + "-" + o)) {
			return distances.get(neighbor + "-" + o);
		}
		return 0.0;
	}
	
}
